<table cellpadding="0" cellspacing="10">
<tr>
	<td valign="top" align="center" style="width:500px;">
		<div>
			<!-- IF album_id -->
			<div style="float:left;margin:3px;">
				{PHOTO_NO}{album.this_index}{PHOTO_UNIT} / {PHOTO_TOTAL}{album.total_photos}{PHOTO_UNIT} | <a href="./?p=photo_album&album_id={album_id}">{RETURN_TO_ALBUM}</a>
			</div>
			<div style="float:right;margin:3px;">
				<a href="./?p=photo&id={previous_photo.photo_id}&album_id={album_id}">{PREVIOUS_PHOTO}</a>&nbsp;/&nbsp;<a href="./?p=photo&id={next_photo.photo_id}&album_id={album_id}">{NEXT_PHOTO}</a>
			</div>
			<!-- ENDIF -->
    	<img src="{image.big}" title="{image.title}

{image.description}" />
		</div>
    </td>
    <td valign="top">

		<!-- IF image.author -->
		<div class='photo_right_block'>
			<h2>{IMAGE_AUTHOR}</h2>
			<span>
				{image.author}
			</span>
		</div>
		<!-- ENDIF -->
		
		<div class='photo_right_block'>
			<h2>{IMAGE_TAG}</h2>
			<span>
				<!-- BEGIN image.tags -->
        		<a href="search.php?keyword={urlencode:tag}">{tag}</a> 
				<!-- END -->
			</span>
		</div>
		
		<!-- IF image.shotdate -->
		<div class='photo_right_block'>
			<h2>{IMAGE_SHOTDATE}</h2>
			<span>
				{image.shotdate}
			</span>
		</div>
        <!-- ENDIF -->
		
		<!-- IF login_user.status="admin" -->
		<div class='photo_right_block'>
			<h2>{ADMIN_ACTIONS}</h2>
			<span>
			<a href="admin.php?p=photo_edit&ids={image.photo_id}" >{EDIT}</a>&nbsp; 
            <a href="javascript:delete_img({image.photo_id});">{DELETE}</a>
            <script>
				function delete_img(id)
				{
					if (!confirm('{DELETE_CONFIRM}')) return;
					$.post("admin.php?p=ajax&m=delete&table=photo&ids="+id,{ },function(id)
					{
						if (id == '{image.photo_id}')
						{
							alert('{DELETE_SUCCESS}');
							window.location = 'index.php?cid={image.category_id}';
						}
						else
						{
							alert('{DELETE_ERROR}');
						}
					});
				}
			</script>
			</span>
		</div>
		<!-- ENDIF -->
		
		<div class='photo_right_block'>
			<h2>{IMAGE_ORIG_SIZE}</h2>
			<span>
        		 {image.orig_size}
			</span>
		</div>
		
		<div class='photo_right_block'>
			<h2>{IMAGE_DOWNLOADED} {image.downloaded}</h2>
			<span>
        	<!-- IF login_user -->
                <a href="admin.php?p=down&id={image.photo_id}&size=orig"><img src="{images}/download.png" border="0" /></a>
            <!-- ELSE -->
            	{LOGIN_THEN_DOWNLOAD}
            <!-- ENDIF -->
			</span>
		</div>
		
	</td>
</tr>
</table>

	<div id='photo_description_wrapper'>
			<div id='photo_description'>
			{image.description}
			</div>
	</div>


    <div id="related_wrapper">
		<div style="float:left;clear:left;font-size:14px;"><b>{RELATED_IMAGE}</b></div>
		<!-- IF parent.album_id --><!-- ELSE -->
			<div style="float:right;clear:right;" id='more_related_images_div'><a href="javascript:void(0);" onclick="load_more_images({image.photo_id})">{MORE_RELATED_IMAGE}</a></div>
		<!-- ENDIF -->
	</div>
	<div id="related_images">
		<!-- IF related_images -->
			<!-- IF parent.album_id -->
				<!-- BEGIN related_images -->
					<a href="./?p=photo&id={photo_id}&album_id={parent.album_id}" title="{title}">
						<div class="related_image" style="cursor:pointer;background:#ffffff url(image.php?path={big}&max=100&method=box) 50% 50% no-repeat;"></div>
					</a>
				<!-- END -->
			<!-- ELSE -->
				<!-- INCLUDE related_images.html -->
			<!-- ENDIF -->
		<!-- ELSE -->
			{NO_RELATED_IMAGE}
		<!-- ENDIF -->
	</div>
<script>
function load_more_images(id)
{
	$('#more_related_images_div').html("{PLEASE_WAIT}");
	$.post('index.php?p=photo&id='+id+'&m=related_images',{ },function(s)
	{
		$('#more_related_images_div').fadeOut();
		$('#related_images').html(s);
		$(window).scrollTo($(document.body).height(),1000);
	});
}
</script>